def _main():
    def generate_denominators():
        previous = 1
        difference = 0
        while True:
            previous += difference
            yield previous
            difference += 1

    ending = 1E-4
    result = 0
    for denominator in generate_denominators():
        item = 1 / denominator
        result += item
        if item < ending:
            break

    print(f"S = {result}")


if __name__ == "__main__":
    _main()
